#pragma once

#include <vector>
#include <GLES3/gl3.h>

namespace asha {
namespace vrlib {

class MDObject3D {
public:
    MDObject3D();
    virtual ~MDObject3D();

    // 加载球体数据
    void LoadSphere();
    
    // 上传数据到 GPU
    void UploadData();
    
    // 执行绘制
    void Draw();

    // 销毁资源
    void Destroy();

private:
    // 生成球体算法
    void GenerateSphere(float radius, int rings, int sectors);

private:
    std::vector<float> vertices_;
    std::vector<float> texcoords_;
    std::vector<short> indices_;

    GLuint vbo_vertices_ = 0;
    GLuint vbo_texcoords_ = 0;
    GLuint ibo_indices_ = 0;
    
    int num_indices_ = 0;
    bool data_uploaded_ = false;
};

}
}
